-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add few shell filters #84179
base: main
Are you sure you want to change the base?
Add few shell filters #84179
Conversation
drivers/dac/dac_shell.c
Outdated
@@ -94,14 +94,31 @@ static int cmd_write_value(const struct shell *sh, size_t argc, char **argv) | |||
return 0; | |||
} | |||
|
|||
static bool device_is_dac(const struct device *dev) | |||
{ | |||
return device_is_ready(dev) && DEVICE_API_IS(dac, dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shell_device_filter already checks device_is_ready so this is superfluous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey you are right! I had copy pasted this from other drivers, removed from all of these and added an extra patch to clean up the existing ones. Thanks!
Add shell device name filtering using DEVICE_API_IS. Signed-off-by: Fabio Baltieri <[email protected]>
Add shell device name filtering using DEVICE_API_IS. Signed-off-by: Fabio Baltieri <[email protected]>
Add shell device name filtering using DEVICE_API_IS. Signed-off-by: Fabio Baltieri <[email protected]>
Drop few redundant device_is_ready for functions that are only used as argument to shell_device_filter, as shell_device_filter checks for that alrady. Suggested-by: Yishai Jaffe <[email protected]> Signed-off-by: Fabio Baltieri <[email protected]>
705c71e
@@ -69,7 +69,7 @@ static void print_callback(const struct device *dev, const enum stepper_event ev | |||
|
|||
static bool stepper_device_check(const struct device *dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change the function name to device_is_stepper
to match the rest?
@@ -336,9 +336,14 @@ static int cmd_i2c_speed(const struct shell *shell_ctx, size_t argc, char **argv | |||
return 0; | |||
} | |||
|
|||
static bool device_is_i2c(const struct device *dev) | |||
{ | |||
return DEVICE_API_IS(i2c, dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i3c extends the i2c API, this should be special cased here.
return DEVICE_API_IS(i2c, dev); | |
return DEVICE_API_IS(i2c, dev) || DEVICE_API_IS(i3c, dev); |
Add few shell filter functions, i2c, regulator and dac.